package com.nit.lab.vote.controller.basic;


import com.nit.lab.vote.controller.vote.ProjectController;
import com.nit.lab.vote.dto.utils.TableReqDTO;
import com.nit.lab.vote.dto.utils.TableRspDTO;
import com.nit.lab.vote.service.basic.SubjectService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/api/subject")
public class SubjectController {
    @Resource
    private SubjectService subjectService;
    private final Logger logger = LoggerFactory.getLogger(ProjectController.class);

    @RequestMapping(value = "/listAll", method = RequestMethod.POST)
    public TableRspDTO list4Table(@RequestBody TableReqDTO tableReqDTO) {
        TableRspDTO tableRspDTO = new TableRspDTO();
        try {
            tableRspDTO = subjectService.list4Table(tableReqDTO);
        } catch (Exception e) {
            logger.error(e.toString());
        }
        return tableRspDTO;
    }
}
